<%@ page language="java" contentType="text/html; charset=ISO-8859-1"
    pageEncoding="ISO-8859-1"%>
    
    
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
<title>Backup</title>
  
  <script language="JavaScript" src="scripts/master.js" type="text/javascript"></script>
    
  <script language="javascript">

  	var busyBackup = false;

  	var backupSupported = true;

	function backup() {

		if(!backupSupported){
			alert("Backup is NOT Supported yet...");
			return;
		}

		if(busyBackup){
			alert("Backup is in progress... Please wait...");
			return;
		}

		var ff = function (response) {			

			var responseStr = "" + response;
			if(responseStr.substring(0,5) == "ERROR") {				
				return;
			}
			if(responseStr.substring(0,9) == "EXCEPTION") {				
				return;
			}
			busyBackup = false;
			document.getElementById("idimg").style.visibility="hidden";
			alert("Server Response: "+responseStr);			
		};
		busyBackup = true;
		document.getElementById("idimg").style.visibility="visible";
		ajaxGet('/BSS/AjaxServlet', 'operation=backup', ff );	
	}

	function gotoReports() {
		if(busyBackup){
			alert("Backup is in progress... Please wait...");
			return;
		}
		document.location.href="/BSS/reports.jsp"; 
	}
</script>
  
</head>
<body>
	<div id="idimg" style="visibility:hidden;">
		<img src="ajax-progress-bar.gif"/>
		<br/>
		Taking Backup... Please wait...
	</div>			
		<br/>
		<br/>
	<a href="#" style="color: green" onclick="backup()"> Backup Database </a>	
		<br/>
		<br/>
		<br/>
	<a href="#" onclick="gotoReports();">Reports</a>
</body>
</html>